import request from '@/utils/request';
//request1 不加header token验证
import request1 from '@/utils/request1';
//门禁弹框api
export async function getAlarmInfoForPage(params) {
  try {
    const res = await request.get('/api/alarmInfo/getAlarmInfoForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//门禁弹框api
export async function dataAnalysisList(params) {
  try {
    const res = await request1.get('/api/dataAnalysis/historydata/list', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//历史车辆
export async function districtCarInfoPageList(params) {
  try {
    const res = await request1.get('/api/basedata/districtVehicleInfo/districtVehicleInfoPageList', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//历史人脸
export async function districtPersonInfoPageList(params) {
  try {
    const res = await request1.get('/api/basedata/districtPersonInfo/districtPersonInfoPageList', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//门禁历史
export async function districtGatedPersoninfoPageList(params) {
  try {
    const res = await request.get('/api//mapGate/getGateInfoForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//实有人口弹框api
export async function GetPeopleInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getPersonsInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//实有车辆
export async function GetCarsInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getCarsInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//实有单位设备汇总
export async function GetUnitTotleAndType(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getUnitTotleAndType', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//实有单位分页查询
export async function GetUnitInfoForPage(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getUnitPageInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//安防设备汇总
export async function GetCamerTotleAndType(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getCamerTotleAndType', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//实有安防设备分页查询
export async function GetCamerInfoForPage(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getCamerInfoForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//实有力量
export async function GetSecurityTotleAndType(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getSecurityTotleAndType', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//实有力量分页
export async function GetSecurityInfoForPage(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getSecurityInfoForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//实有安防设备
export async function GetCamerInfoForPage1(params) {
  try {
    const res = await request.get('/api/camerInfo/getCamerInfoForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取iot
export async function GetDevSens(params) {
  try {
    const res = await request.get('/api/system/devSensor/getDeviceTypeNum', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data.itmes) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取iotlist
export async function GetDevSensorForPage(params) {
  try {
    const res = await request.get('/api/system/devSensor/list', {
      params
    });



    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取重点人员类型
export async function GetKeyPerson(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getKeyPersonNumByType', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取租房管理数据
export async function GetzufangInfo(params) {
  try {
    const res = await request.get('/api/mapTenant/getTenantInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取重点人员分页
export async function GetKeyPersonPageInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getKeyPersonPageInfo', {
      params
    });



    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//实有房屋
export async function GetRoomInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getRoomInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

// //获取重点人员类型
// export async function GetKeyPerson(params) {
//   try {
//     const res = await request.get('/api/mapMobileClient/info/getKeyPersonNumByType', {
//       params
//     });
//     return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
//   } catch (error) {
//     return Promise.reject(error)
//   }
// }

//疫情防控
export async function GetEpidemicInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getEpidemicInfoInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//疫情防控人员详情
export async function GetEpidemicInfoDetail(id) {
  try {
    const res = await request.get(`/api/mapMobileClient/info/getEpidemicInfoById/${id}`);
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//地图一标八实信息汇总
export async function GetMapInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getMapInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取小区边界
export async function GetBorderCell(commId) {
  try {
    const res = await request.get(`/api/mapMobileClient/info/getBorderCell/${commId}`)
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//根据小区id获取楼栋信息
export async function GetBuildingList(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getBuildingList', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取房屋内人员列表
export async function GetPeopleListForRomm(rommId) {
  try {
    const res = await request.get(`/api/mapMobileClient/info/getPeopleByRoomId/${rommId}`)
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据身份证号获取人员详细信息api
export async function getPersonInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getPersonInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据人口分页
export async function getPersonPageInfo(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getPersonPageInfo', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据疫情人口分页
export async function getIsOlationsPage(params) {
  try {
    const res = await request.get('/api/mapMobileClient/info/getIsOlationsPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取房屋信息
export async function GetFloorInfo(builId) {
  try {
    const res = await request.get(`/api/mapMobileClient/info/getBuildingInfo/${builId}`)
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据枚举类型获取枚举对应的值
export async function GetDictDataEnum(dictType) {
  try {
    const res = await request.get(`/api/mapMobileClient/info/getDictDataEnum/${dictType}`)
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取只会门禁弹窗信息
export async function GetGateInfo(params) {
  try {
    const res = await request.get('/api/mapGate/getGateInfo', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//获取门禁本日工作
export async function GetGatedPersonForPage(params) {
  try {
    const res = await request.get('/api/mapGate/getGatedPersonForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取分页租房申报本日工作
export async function GetHouseDeclarForPage(params) {
  try {
    const res = await request.get('/api/mapTenant/getHouseDeclarForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//获取分页租房申报本日工作
export async function GetDoorAccessForThreeDay(params) {
  try {
    const res = await request.get('/api/mapGate/getDoorAccessForThreeDay', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//实有车辆弹框分页获取车辆信息
export async function getCarForPage(params) {
  try {
    const res = await request.get('/api/carInfo/getCarForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//分页获取门禁人证机登记信息
export async function getDoorAccessInfoForPage(params) {
  try {
    const res = await request.get('/api/mapGate/getDoorAccessInfoForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//房屋申报分页查询
export async function getHouseRentalForPage(params) {
  try {
    const res = await request.get('/api/mapTenant/getHouseRentalForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//房屋申报房东二房东分页查询
export async function getHouseOwnerForPage(params) {
  try {
    const res = await request.get('/api/mapTenant/getHouseOwnerForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//房屋申报租客分页查询
export async function getHouseTenantForPage(params) {
  try {
    const res = await request.get('/api/mapTenant/getHouseTenantForPage', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

export function getPhotouUrl(){
  return 'http://192.168.110.220:8080/smartcommunity/getPic/getPicByIdNum?idNum='
}

//近30天楼栋出入数据
export async function getBuildingGateByDay(params) {
  try {
    const res = await request.get('/api/mapGate/getBuildingGateByDay', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//近24小时楼栋出入数据
export async function getBuildingGateByHour(params) {
  try {
    const res = await request.get('/api/mapGate/getBuildingGateByHour', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//近30天大门出入数据
export async function getRoomGatedByDay(params) {
  try {
    const res = await request.get('/api/mapGate/getRoomGatedByDay', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//近24小时大门出入数据
export async function getRoomGatedByHoure(params) {
  try {
    const res = await request.get('/api/mapGate/getRoomGatedByHoure', {
      params
    })
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据小区id获取配置项
export async function getDisConfigByPlaceId(placeId) {
  try {
    const res = await request.get(`/api/basedata/districtConfig/getDisConfigByPlaceId/${placeId}`)
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//人员监控分页列表
export async function monitorPersonPageList(params) {
  try {
    const res = await request.get('/api/monitorInfo/getMonitorPersonForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//车辆监控分页列表
export async function monitorCarPageList(params) {
  try {
    const res = await request.get('/api/monitorInfo/getMonitorCarForPage', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}


//车辆监控分页列表
export async function getFlowChart(placeId) {
  try {
    const res = await request.get(`/api/flowChartInfo/getFlowChart/${placeId}`);
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//根据楼栋id分页获取门禁记录
export async function getGatedByUnitId(params) {
  try {
    const res = await request.get('/api/mapGate/getGatedByUnitId', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}
//根据楼栋id分页获取人脸抓拍记录
export async function getUnitGatedByUnitId(params) {
  try {
    const res = await request.get('/api/mapGate/getUnitGatedByUnitId', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取车辆异常行为分析
export async function CarAnomalies(params) {
  try {
    const res = await request.get('/api/carInfo/carAnomalies', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取人员异常行为分析
export async function PersonnelAnomalies(params) {
  try {
    const res = await request.get('/api/mapGate/personnelAnomalies', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

//获取独居老人异常行为分析
export async function OldPeopleAnomalies(params) {
  try {
    const res = await request.get('/api/mapGate/oldPeopleAnomalies', {
      params
    });
    return res.code == 200 ? Promise.resolve(res.data) : Promise.reject(res.msg)
  } catch (error) {
    return Promise.reject(error)
  }
}

export async function saveMonitorPerson(params) {
  try {
      const res = await request.post('/api/monitor/person/saveMonitorPerson',
          params
      );
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}


export async function saveMonitorCar(params) {
  try {
      const res = await request.post('/api/monitor/car/saveMonitorCar',
          params
      );
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}

export async function updateMonitorPerson(params) {
  try {
      const res = await request.put('/api/monitor/person/updateMonitorPerson',
          params
      );
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}


export async function updateMonitorCar(params) {
  try {
      const res = await request.put('/api/monitor/car/updateMonitorCar',
          params
      );
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}

export async function deleteMonitorPerson(id) {
  try {
      const res = await request.delete(`/api/monitor/person/delete/${id}`);
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}

export async function deleteMonitorCar(id) {
  try {
      const res = await request.delete(`/api/monitor/car/delete/${id}`);
      return res && res.code == 200 ? Promise.resolve(res) : Promise.reject(res.msg)
  } catch (error) {
      return Promise.reject(error)
  }
}
